package chujisuanfa;

import java.util.ArrayList;
import java.util.List;

public class Sort {
    public int[] merge(int[] nums1, int m, int[] nums2, int n) {
        int n1 = 0;
        int n2 = 0;
        int[] copy1 = nums1.clone();
        for(int i=0;i<m+n;++i){
            if(n2>=n||(copy1[n1]<=nums2[n2]&&n1<m)){
                nums1[i]=copy1[n1++];
            }else{
                nums1[i]=nums2[n2++];
            }
        }

        return nums1;
    }
    //
    public String minNumber(int[] nums) {
        StringBuilder sb = new StringBuilder();
        return sb.toString();
    }

    public void sortQuick(int[] nums ,int l,int h){
        if (l>=h) return;
        int i = l,j=h,temp;
        while(j>i){
            while(nums[j]>=nums[l]&&i<j) j--;
            while(nums[i]<=nums[l]&&i<j) i++;
            temp = nums[i];
            nums[i] = nums[j];
            nums[j] = temp;
        }
        temp = nums[l];
        nums[l] = nums[i];
        nums[i] = temp;
        sortQuick(nums,l,i-1);
        sortQuick(nums,i+1,h);
    }

    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        for(int i = 1;i<=15;++i){
            if(i%3==0&&i%5==0)  list.add("FizzBuzz");
            else if(i%3==0) list.add("Fizz");
            else if(i%5==0) list.add("Buzz");
            else list.add(""+i);
        }
        System.out.println(list);
        int a= (int) Math.pow(5,0.5);
        System.out.println();

        int[] nu = new int[]{3,5,6,1,4,1,2};
        Sort sort = new Sort();
        sort.sortQuick(nu,0,6);
        for (int i:nu
             ) {
            System.out.print(i);
            System.out.print("  ");
        }


    }
}
